<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html lang="<?php echo ((isset($lang) && ($lang !== ""))?($lang):'zh-cmn-Hans-CN'); ?>">
	<head>
		<meta charset="utf-8" />
		<title><?php echo ((isset($title) && ($title !== ""))?($title):'网站后台'); ?></title>		
		<meta name="keywords" content="<?php echo ((isset($keywords) && ($keywords !== ""))?($keywords):'网站后台'); ?>" />
		<meta name="description" content="<?php echo ((isset($description) && ($description !== ""))?($description):'网站后台'); ?>" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0" />

		<!-- basic styles -->

		<link href="/website/Public/css/bootstrap.min.css" rel="stylesheet" />
		<link rel="stylesheet" href="/website/Public/css/font-awesome.min.css" />

		<!--[if IE 7]>
		  <link rel="stylesheet" href="/website/Public/css/font-awesome-ie7.min.css" />
		<![endif]-->

		<!-- page specific plugin styles -->

		<link rel="stylesheet" href="/website/Public/css/jquery-ui-1.10.3.custom.min.css" />
		
		<!-- fonts -->

		<link rel="stylesheet" href="http://fonts.useso.com/css?family=Open+Sans:400,300" />

		<!-- ace styles -->

		<link rel="stylesheet" href="/website/Public/css/ace.min.css" />
		<link rel="stylesheet" href="/website/Public/css/ace-rtl.min.css" />
		<link rel="stylesheet" href="/website/Public/css/ace-skins.min.css" />

		<!--[if lte IE 8]>
		  <link rel="stylesheet" href="/website/Public/css/ace-ie.min.css" />
		<![endif]-->


		<!-- inline styles related to this page -->

		<!-- ace settings handler -->

		<script src="/website/Public/js/ace-extra.min.js"></script>

		<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->

		<!--[if lt IE 9]>
		<script src="/website/Public/js/html5shiv.js"></script>
		<script src="/website/Public/js/respond.min.js"></script>
		<![endif]-->
	</head>

	<body>
				<div class="navbar navbar-default" id="navbar">
			<script type="text/javascript">
				try{ace.settings.check('navbar' , 'fixed')}catch(e){}
			</script>

			<div class="navbar-container" id="navbar-container">
				<div class="navbar-header pull-left">
					<a href="#" class="navbar-brand" style="max-height:42px;"><!-- 跟模版比高度多了8像素，所以手动限制了 -->
						<small>
							<i class="icon-leaf"></i>
							网站后台
						</small>
					</a><!-- /.brand -->
				</div><!-- /.navbar-header -->

				<div class="navbar-header pull-right" role="navigation">
					<ul class="nav ace-nav">
						<li class="grey">
							<a data-toggle="dropdown" class="dropdown-toggle" href="#">
								<i class="icon-tasks"></i>
								<span class="badge badge-grey">4</span>
							</a>

							<ul class="pull-right dropdown-navbar dropdown-menu dropdown-caret dropdown-close">
								<li class="dropdown-header">
									<i class="icon-ok"></i>
									4 Tasks to complete
								</li>

								<li>
									<a href="#">
										<div class="clearfix">
											<span class="pull-left">Software Update</span>
											<span class="pull-right">65%</span>
										</div>

										<div class="progress progress-mini ">
											<div style="width:65%" class="progress-bar "></div>
										</div>
									</a>
								</li>

								<li>
									<a href="#">
										<div class="clearfix">
											<span class="pull-left">Hardware Upgrade</span>
											<span class="pull-right">35%</span>
										</div>

										<div class="progress progress-mini ">
											<div style="width:35%" class="progress-bar progress-bar-danger"></div>
										</div>
									</a>
								</li>

								<li>
									<a href="#">
										<div class="clearfix">
											<span class="pull-left">Unit Testing</span>
											<span class="pull-right">15%</span>
										</div>

										<div class="progress progress-mini ">
											<div style="width:15%" class="progress-bar progress-bar-warning"></div>
										</div>
									</a>
								</li>

								<li>
									<a href="#">
										<div class="clearfix">
											<span class="pull-left">Bug Fixes</span>
											<span class="pull-right">90%</span>
										</div>

										<div class="progress progress-mini progress-striped active">
											<div style="width:90%" class="progress-bar progress-bar-success"></div>
										</div>
									</a>
								</li>

								<li>
									<a href="#">
										See tasks with details
										<i class="icon-arrow-right"></i>
									</a>
								</li>
							</ul>
						</li>

						<li class="purple">
							<a data-toggle="dropdown" class="dropdown-toggle" href="#">
								<i class="icon-bell-alt icon-animated-bell"></i>
								<span class="badge badge-important">8</span>
							</a>

							<ul class="pull-right dropdown-navbar navbar-pink dropdown-menu dropdown-caret dropdown-close">
								<li class="dropdown-header">
									<i class="icon-warning-sign"></i>
									8 Notifications
								</li>

								<li>
									<a href="#">
										<div class="clearfix">
											<span class="pull-left">
												<i class="btn btn-xs no-hover btn-pink icon-comment"></i>
												New Comments
											</span>
											<span class="pull-right badge badge-info">+12</span>
										</div>
									</a>
								</li>

								<li>
									<a href="#">
										<i class="btn btn-xs btn-primary icon-user"></i>
										Bob just signed up as an editor ...
									</a>
								</li>

								<li>
									<a href="#">
										<div class="clearfix">
											<span class="pull-left">
												<i class="btn btn-xs no-hover btn-success icon-shopping-cart"></i>
												New Orders
											</span>
											<span class="pull-right badge badge-success">+8</span>
										</div>
									</a>
								</li>

								<li>
									<a href="#">
										<div class="clearfix">
											<span class="pull-left">
												<i class="btn btn-xs no-hover btn-info icon-twitter"></i>
												Followers
											</span>
											<span class="pull-right badge badge-info">+11</span>
										</div>
									</a>
								</li>

								<li>
									<a href="#">
										See all notifications
										<i class="icon-arrow-right"></i>
									</a>
								</li>
							</ul>
						</li>

						<li class="green">
							<a data-toggle="dropdown" class="dropdown-toggle" href="#">
								<i class="icon-envelope icon-animated-vertical"></i>
								<span class="badge badge-success">5</span>
							</a>

							<ul class="pull-right dropdown-navbar dropdown-menu dropdown-caret dropdown-close">
								<li class="dropdown-header">
									<i class="icon-envelope-alt"></i>
									5 Messages
								</li>

								<li>
									<a href="#">
										<span class="msg-body">
											<span class="msg-title">
												<span class="blue">Alex:</span>
												Ciao sociis natoque penatibus et auctor ...
											</span>

											<span class="msg-time">
												<i class="icon-time"></i>
												<span>a moment ago</span>
											</span>
										</span>
									</a>
								</li>

								<li>
									<a href="#">
										<span class="msg-body">
											<span class="msg-title">
												<span class="blue">Susan:</span>
												Vestibulum id ligula porta felis euismod ...
											</span>

											<span class="msg-time">
												<i class="icon-time"></i>
												<span>20 minutes ago</span>
											</span>
										</span>
									</a>
								</li>

								<li>
									<a href="#">
										<span class="msg-body">
											<span class="msg-title">
												<span class="blue">Bob:</span>
												Nullam quis risus eget urna mollis ornare ...
											</span>

											<span class="msg-time">
												<i class="icon-time"></i>
												<span>3:15 pm</span>
											</span>
										</span>
									</a>
								</li>

								<li>
									<a href="inbox.html">
										See all messages
										<i class="icon-arrow-right"></i>
									</a>
								</li>
							</ul>
						</li>

						<li class="light-blue">
							<a data-toggle="dropdown" href="#" class="dropdown-toggle">
								<!--<img class="nav-user-photo" src="assets/avatars/user.jpg" alt="Jason's Photo" />-->
								<span class="user-info">
									<small>欢迎,</small>
									<?php echo (session('username')); ?>
								</span>

								<i class="icon-caret-down"></i>
							</a>

							<ul class="user-menu pull-right dropdown-menu dropdown-yellow dropdown-caret dropdown-close">
								<li>
									<a href="#">
										<i class="icon-cog"></i>
										设置
									</a>
								</li>

								<li>
									<a href="#">
										<i class="icon-user"></i>
										个人资料
									</a>
								</li>

								<li class="divider"></li>

								<li>
									<a href="/website/Admin/login/login_out_do">
										<i class="icon-off"></i>
										退出登录
									</a>
								</li>
							</ul>
						</li>
					</ul><!-- /.ace-nav -->
				</div><!-- /.navbar-header -->
			</div><!-- /.container -->
		</div>

		<div class="main-container" id="main-container">
			<script type="text/javascript">
				try{ace.settings.check('main-container' , 'fixed')}catch(e){}
			</script>

			<div class="main-container-inner">
				<a class="menu-toggler" id="menu-toggler" href="#">
					<span class="menu-text"></span>
				</a>

				
				<div class="sidebar" id="sidebar">
					<script type="text/javascript">
						try{ace.settings.check('sidebar' , 'fixed')}catch(e){}
					</script>

					<div class="sidebar-shortcuts" id="sidebar-shortcuts">
						<div class="sidebar-shortcuts-large" id="sidebar-shortcuts-large">
							<button class="btn btn-success">
								<i class="icon-signal"></i>
							</button>

							<button class="btn btn-info">
								<i class="icon-pencil"></i>
							</button>

							<button class="btn btn-warning">
								<i class="icon-group"></i>
							</button>

							<button class="btn btn-danger">
								<i class="icon-cogs"></i>
							</button>
						</div>

						<div class="sidebar-shortcuts-mini" id="sidebar-shortcuts-mini">
							<span class="btn btn-success"></span>

							<span class="btn btn-info"></span>

							<span class="btn btn-warning"></span>

							<span class="btn btn-danger"></span>
						</div>
					</div><!-- #sidebar-shortcuts -->

					<ul class="nav nav-list">
					
						<?php echo W('Sidebar/Sidebar_list');?> 

					</ul><!-- /.nav-list -->

					<div class="sidebar-collapse" id="sidebar-collapse">
						<i class="icon-double-angle-left" data-icon1="icon-double-angle-left" data-icon2="icon-double-angle-right"></i>
					</div>

					<script type="text/javascript">
						try{ace.settings.check('sidebar' , 'collapsed')}catch(e){}
					</script>
				</div>

				<div class="main-content">
					
					<div class="breadcrumbs" id="breadcrumbs">
						<script type="text/javascript">
							try{ace.settings.check('breadcrumbs' , 'fixed')}catch(e){}
						</script>

						<ul class="breadcrumb">
							<li>
								<i class="icon-home home-icon"></i>
								<a href="/website/Admin/index/welcome"><?php echo ((isset($pageLocal[0]) && ($pageLocal[0] !== ""))?($pageLocal[0]):'主页'); ?></a>
							</li>
							<li class="active"><?php echo ((isset($pageLocal[1]) && ($pageLocal[1] !== ""))?($pageLocal[1]):'当前页'); ?></li>
						</ul><!-- .breadcrumb -->

						<div class="nav-search" id="nav-search">
							<form class="form-search">
								<span class="input-icon">
									<input type="text" placeholder="查找 ..." class="nav-search-input" id="nav-search-input" autocomplete="off" />
									<i class="icon-search nav-search-icon"></i>
								</span>
							</form>
						</div><!-- #nav-search -->
					</div>

					<div class="page-content">
						<div class="page-header">
							<h1>
								管理员帐号管理
								<small>
									<i class="icon-double-angle-right"></i>
									后台管理员列表
								</small>
							</h1>
						</div><!-- /.page-header -->

									
<div class="form-group">
  <form class="navbar-form" role="search" action="" >
  	<div class="input-group pull-right no-margin">
	  <a href="#table-add" data-toggle="modal" >
	    <button class="btn btn-success">添加帐号</button>
	  </a>
    </div>
    
    <label class="sr-only" for="findRole">查找管理员:</label>
    <div class="input-group ">
      <input type="text" class="form-control" name="adminFilter" id="findRole" placeholder="<?php echo ((isset($adminFilter) && ($adminFilter !== ""))?($adminFilter):'查找管理员...'); ?>">
    </div>
                  
	<div class="input-group ">
      <button type="submit" class="btn btn-sm btn-info">
                          <i class="icon-ok"></i>
                          过滤
      </button>
    </div>  	
  </form>
</div>						

<div class="row" id="main_div">
	<div class="col-xs-12">
		<!-- PAGE CONTENT BEGINS -->

		<div class="row">
			<div class="col-xs-12">
				<div class="table-responsive">
					<table id="sample-table-1" class="table table-striped table-bordered table-hover">
						<thead>
							<tr>
								<th class="hidden-240">管理员帐号名</th>
								<th>管理员所属角色</th>
								<th>最后一次登录ip</th>
								<th>注册时间</th>
								<th>状态</th>
								<th>操作</th>
							</tr>
						</thead>

						<tbody>
						
						<?php if(is_array($list)): $i = 0; $__LIST__ = $list;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?><tr>

								<td class="hidden-240">
									<strong><?php echo ($vo["username"]); ?></strong>
								</td>
								<td><?php echo ((isset($vo["RoleName"]) && ($vo["RoleName"] !== ""))?($vo["RoleName"]):'该角色已被删除'); ?></td>
								<td><?php echo ((isset($vo["last_ip"]) && ($vo["last_ip"] !== ""))?($vo["last_ip"]):'该帐号尚未登录过'); ?></td>
								<td><?php echo (date('Y-m-d H:i:s',$vo["create_time"])); ?></td>
								<td>
								<?php  $is_active = '<span class="label label-sm label-success">已启用</span>'; $not_active = '<span class="label label-sm label-inverse arrowed-in">已禁用</span>';?>
								<a href="javascript:" onclick="ChangeStatus(<?php echo ($vo["id"]); ?>,<?php echo ($vo["is_active"]); ?>)" id="is_enabled<?php echo ($vo["id"]); ?>"><?php echo ($vo['is_active']?$is_active:$not_active); ?></a>	
								</td>
								<td>
									<div class="visible-md visible-lg hidden-sm hidden-xs btn-group">

										
										<button class="btn btn-xs btn-info">
											<a href="#table-alter" data-toggle="modal" onclick="getRole(<?php echo ($vo['id']); ?>)" style="color:#fff;" ><i class="icon-edit bigger-120">编辑</i></a>
										</button>
                                        

										<button id="id-btn-dialog2" class="btn btn-xs btn-danger">
											<i class="icon-trash bigger-120" onclick="deleteConfirm(<?php echo ($vo['id']); ?>)">删除</i>
										</button>

									</div>

									<div class="visible-xs visible-sm hidden-md hidden-lg">
										<div class="inline position-relative">
											<button class="btn btn-minier btn-primary dropdown-toggle" data-toggle="dropdown">
												<i class="icon-cog icon-only bigger-110"></i>
											</button>

											<ul class="dropdown-menu dropdown-only-icon dropdown-yellow pull-right dropdown-caret dropdown-close">
												<li>
													<a href="#" class="tooltip-info" data-rel="tooltip" title="View">
														<span class="blue">
															<i class="icon-zoom-in bigger-120"></i>
														</span>
													</a>
												</li>

												<li>
													<a href="#" class="tooltip-success" data-rel="tooltip" title="Edit">
														<span class="green">
															<i class="icon-edit bigger-120"></i>
														</span>
													</a>
												</li>

												<li>
													<a href="#" class="tooltip-error" data-rel="tooltip" title="Delete">
														<span class="red">
															<i class="icon-trash bigger-120"></i>
														</span>
													</a>
												</li>
											</ul>
										</div>
									</div>
								</td>
							</tr><?php endforeach; endif; else: echo "" ;endif; ?>

						</tbody>
					</table>
				</div><!-- /.table-responsive -->
				
				<?php echo ($page); ?>
							
			</div><!-- /span -->
		</div><!-- /row -->
			
		<?php echo W('Windows/user_add');?> 	
		
		<?php echo W('Windows/user_update');?> 
			
		<div class="hr hr-18 dotted hr-double"></div>

	</div><!-- /.col -->
</div><!-- /.row -->

						
					</div><!-- /.page-content -->
				</div><!-- /.main-content -->

								<div class="ace-settings-container" id="ace-settings-container">
					<div class="btn btn-app btn-xs btn-warning ace-settings-btn" id="ace-settings-btn">
						<i class="icon-cog bigger-150"></i>
					</div>

					<div class="ace-settings-box" id="ace-settings-box">
						<div>
							<div class="pull-left">
								<select id="skin-colorpicker" class="hide">
									<option data-skin="default" value="#438EB9">#438EB9</option>
									<option data-skin="skin-1" value="#222A2D">#222A2D</option>
									<option data-skin="skin-2" value="#C6487E">#C6487E</option>
									<option data-skin="skin-3" value="#D0D0D0">#D0D0D0</option>
								</select>
							</div>
							<span>&nbsp; 选择皮肤</span>
						</div>

						<div>
							<input type="checkbox" class="ace ace-checkbox-2" id="ace-settings-navbar" />
							<label class="lbl" for="ace-settings-navbar"> 固定导航条</label>
						</div>

						<div>
							<input type="checkbox" class="ace ace-checkbox-2" id="ace-settings-sidebar" />
							<label class="lbl" for="ace-settings-sidebar"> 固定边栏导航</label>
						</div>

						<div>
							<input type="checkbox" class="ace ace-checkbox-2" id="ace-settings-breadcrumbs" />
							<label class="lbl" for="ace-settings-breadcrumbs"> 固定面包屑导航</label>
						</div>

						<div>
							<input type="checkbox" class="ace ace-checkbox-2" id="ace-settings-rtl" />
							<label class="lbl" for="ace-settings-rtl"> 阅读方式从右到左 </label>
						</div>

						<div>
							<input type="checkbox" class="ace ace-checkbox-2" id="ace-settings-add-container" />
							<label class="lbl" for="ace-settings-add-container">
								居中显示
							</label>
						</div>
					</div>
				</div><!-- /#ace-settings-container -->
			</div><!-- /.main-container-inner -->

			<a href="#" id="btn-scroll-up" class="btn-scroll-up btn btn-sm btn-inverse">
				<i class="icon-double-angle-up icon-only bigger-110"></i>
			</a>
		</div><!-- /.main-container -->

				<!-- basic scripts -->

		<!--[if !IE]> -->

		<script src="http://ajax.useso.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>

		<!-- <![endif]-->

		<!--[if IE]>
<script src="http://ajax.useso.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<![endif]-->

		<!--[if !IE]> -->

		<script type="text/javascript">
			window.jQuery || document.write("<script src='/website/Public/js/jquery-2.0.3.min.js'>"+"<"+"/script>");
		</script>

		<!-- <![endif]-->

		<!--[if IE]>
<script type="text/javascript">
 window.jQuery || document.write("<script src='/website/Public/js/jquery-1.10.2.min.js'>"+"<"+"/script>");
</script>
<![endif]-->

		<script type="text/javascript">
			if("ontouchend" in document) document.write("<script src='/website/Public/js/jquery.mobile.custom.min.js'>"+"<"+"/script>");
		</script>
		<script src="/website/Public/js/bootstrap.min.js"></script>
		<script src="/website/Public/js/typeahead-bs2.min.js"></script>

		<!-- page specific plugin scripts -->
		
		<script src="/website/Public/js/jquery-ui-1.10.3.custom.min.js"></script>
		<script src="/website/Public/js/jquery.ui.touch-punch.min.js"></script>

		<!-- ace scripts -->

		<script src="/website/Public/js/ace-elements.min.js"></script>
		<script src="/website/Public/js/ace.min.js"></script>		
		
<!-- inline scripts related to this page -->

<script type="text/javascript">
	jQuery(function($) {
		
		$('table th input:checkbox').on('click' , function(){
			var that = this;
			$(this).closest('table').find('tr > td:first-child input:checkbox')
			.each(function(){
				this.checked = that.checked;
				$(this).closest('tr').toggleClass('selected');
			});
				
		});
	
	
		$('[data-rel="tooltip"]').tooltip({placement: tooltip_placement});
		function tooltip_placement(context, source) {
			var $source = $(source);
			var $parent = $source.closest('table')
			var off1 = $parent.offset();
			var w1 = $parent.width();
	
			var off2 = $source.offset();
			var w2 = $source.width();
	
			if( parseInt(off2.left) < parseInt(off1.left) + parseInt(w1 / 2) ) return 'right';
			return 'left';
		}
	})
	
	//改变帐号状态
	function ChangeStatus(ids,active){
		var html_str	= active==1?'<?php echo ($not_active); ?>':'<?php echo ($is_active); ?>';
		$.get("/website/Admin/System/user_update_status", { id: ids, is_active: active==1?0:1 },
		function(data){
			if(data){
				$("#is_enabled"+ids).html(html_str);
				$("#is_enabled"+ids).attr("onclick","ChangeStatus("+ids+","+(active==1?0:1)+")");
			}
		});		
	}
	
	//获取帐号数据
	function getRole(ids){
		$.get("/website/Admin/System/user_get_data", { id: ids},
		function(data){
			if(data){
				$("#useraname").attr("value",data.username);
				$("#userId").attr("value",data.id);
				var op	= document.getElementById("forRoles");
				for(var i=0;i<op.length;i++){
					if(op[i].value==data.role_id){
						document.getElementById("forRoles")[i].selected=true;
					}
					else{
						document.getElementById("forRoles")[i].selected=false;
					}
				}
			}
		});	
	}	
	
	//删除帐号确认
	function deleteConfirm(id){
		if(confirm("确定要删除该帐号吗？")){
			window.location.href="/website/Admin/System/deleteUser?id="+id;
		}
	}	
	
</script>


</body>
</html>